<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('新增【请填写功能名称】')" />
</head>
<body class="white-bg">

<!-- Modal -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title" id="myModalLabel">Modal title</h4>
            </div>
            <div class="modal-body">
                ...
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                <button type="button" class="btn btn-primary">Save changes</button>
            </div>
        </div>
    </div>
</div>

    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-storage-add">
            <div class="form-group">
                <label class="col-sm-3 control-label">车牌号：</label>
                <div class="col-sm-8">
                    <input name="storageCph" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">VIN码：</label>
                <div class="col-sm-8">
                    <input name="vinCode" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">车辆公告型号：</label>
                <div class="col-sm-8">
                    <input name="carModel" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">配置名称：</label>
                <div class="col-sm-8">
                    <input name="carConfig" class="form-control" type="text">
                </div>
            </div>
            <div class="col-md-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label">车辆种类：</label>
                    <div class="col-sm-9">
                        <select class="form-control" name="carKind">
                            <option>---------</option>
                        </select>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">电池包编号：</label>
                <div class="col-sm-8">
                    <input name="batteryPackage" class="form-control" type="text" >
                    <div class="ibox-content" id="test">
                    <button type="button" class="btn btn-success" data-toggle="modal" data-target="#myModal" name="batteryPackage">+</button>
                    </div>>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">驱动电机编号：</label>
                <div class="col-sm-8">
                    <input name="powerCode" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">生产批次号：</label>
                <div class="col-sm-8">
                    <input name="batchNumber" class="form-control" type="text">
                </div>
            </div>
            <div class="col-md-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label">下线质检状态：</label>
                    <div class="col-sm-9">
                        <select class="form-control" name="downlineQualityStatus">
                            <OPTION>请选择下线质检状态</OPTION>
                            <OPTION>通过</OPTION>
                            <OPTION>未通过</OPTION>

                        </select>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">车辆合格证编号：</label>
                <div class="col-sm-8">
                    <input name="carQualifiedNumber" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">整车保质期：</label>
                <div class="col-sm-8">
                    <input name="carExpirationDate" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">零件id：</label>
                <div class="col-sm-8">
                    <input name="modelId" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">销售表外键：</label>
                <div class="col-sm-8">
                    <input name="sellId" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">运营表外键：</label>
                <div class="col-sm-8">
                    <input name="operatingId" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">报废表外键：</label>
                <div class="col-sm-8">
                    <input name="scropId" class="form-control" type="text">
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <script type="text/javascript">
        var prefix = ctx + "system/storage"
        $("#form-storage-add").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/add", $('#form-storage-add').serialize());
            }
        }

       $(function () {
           $.post(
               "xl",
               function (obj) {

                   for(var i in obj){
                       $("[name='carKind']").append($("<option value="+obj[i].tname+">"+obj[i].tname+"</option>"));
                   }
               }
           )
       })
    </script>
    <script >
        $(function () {
            $.post(
                "tan",
                function (obj) {
                    for(var i in obj){
                        $("[name='batteryPackage']").val(obj.sellId);
                        $("[name='batteryPackage']").val(obj.carCard);
                        $("[name='batteryPackage']").val(obj.sellAddre);
                    }

                }
            )
        })

    </script>
</body>
</html>
